#import "HHActivityCollectionCell.h"
#import <BCWebImageKit/UIImageView+BCWebImage.h>
#import <BCFoundation/UIImage+BCHelper.h>
#import <BCFoundation/UIColor+BCHelper.h>

@interface HHActivityCollectionCell ()

@property (nonatomic, strong) UIImage *placeholderImage;

@end

@implementation HHActivityCollectionCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setupImageView];
    }
    
    return self;
}
- (void)setImgUrl:(NSString *)imgUrl {
    _imgUrl = imgUrl;
  
    [_imgView bc_setImageWithURL:imgUrl placeHolderImage:self.placeholderImage];
}

- (void)setupImageView
{
    UIImageView* imageView = [[UIImageView alloc] init];
    imageView.clipsToBounds = YES;
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    _imgView = imageView;
    [self addSubview:imageView];
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    _imgView.frame = self.bounds;
}


- (UIImage *)placeholderImage {
    if (!_placeholderImage) {
        _placeholderImage = [UIImage bc_imageWithRoundedCornerRadius:10 renderColor:kBCRGBColor(0xDCDCDC) renderSize:self.bounds.size borderWidth:0 borderCorlor:UIColor.clearColor];
    }
    return _placeholderImage;
}
@end
